package dbtools.structures;

import java.io.Serializable;

public class DBUniqueKey implements Serializable
{
	private static final long serialVersionUID = 1L;
	private DBKeyElement[] dbKeyElements;
	private String name;
	private DBTable table=null;
	
	public DBUniqueKey(String indexName,DBKeyElement...keyElements){
		this.dbKeyElements = keyElements;
		this.name = indexName;
	}

	
	public String getName() {
		return name;
	}


	public DBKeyElement[] getDbKeyElements() {
		return dbKeyElements;
	}


	public void setTable(DBTable table) {
		this.table = table;
	}
	
	public DBTable getTable(){
		return table;
	}


	public boolean containsField(DBField fld) {
		for (DBKeyElement elem : dbKeyElements){
			if (elem.getTheField() == fld){
				return true;
			}
		}
		return false;
	}

}
